<!DOCTYPE html><html><head>
      <title>Lora技术</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      <link rel="stylesheet" href="file:////home/wlxuz/.vscode-server/extensions/shd101wyy.markdown-preview-enhanced-0.8.13/crossnote/dependencies/katex/katex.min.css">
      
      
      
      
      
      <style>
      code[class*=language-],pre[class*=language-]{color:#333;background:0 0;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.4;-moz-tab-size:8;-o-tab-size:8;tab-size:8;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:.8em;overflow:auto;border-radius:3px;background:#f5f5f5}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal;background:#f5f5f5}.token.blockquote,.token.comment{color:#969896}.token.cdata{color:#183691}.token.doctype,.token.macro.property,.token.punctuation,.token.variable{color:#333}.token.builtin,.token.important,.token.keyword,.token.operator,.token.rule{color:#a71d5d}.token.attr-value,.token.regex,.token.string,.token.url{color:#183691}.token.atrule,.token.boolean,.token.code,.token.command,.token.constant,.token.entity,.token.number,.token.property,.token.symbol{color:#0086b3}.token.prolog,.token.selector,.token.tag{color:#63a35c}.token.attr-name,.token.class,.token.class-name,.token.function,.token.id,.token.namespace,.token.pseudo-class,.token.pseudo-element,.token.url-reference .token.variable{color:#795da3}.token.entity{cursor:help}.token.title,.token.title .token.punctuation{font-weight:700;color:#1d3e81}.token.list{color:#ed6a43}.token.inserted{background-color:#eaffea;color:#55a532}.token.deleted{background-color:#ffecec;color:#bd2c00}.token.bold{font-weight:700}.token.italic{font-style:italic}.language-json .token.property{color:#183691}.language-markup .token.tag .token.punctuation{color:#333}.language-css .token.function,code.language-css{color:#0086b3}.language-yaml .token.atrule{color:#63a35c}code.language-yaml{color:#183691}.language-ruby .token.function{color:#333}.language-markdown .token.url{color:#795da3}.language-makefile .token.symbol{color:#795da3}.language-makefile .token.variable{color:#183691}.language-makefile .token.builtin{color:#0086b3}.language-bash .token.keyword{color:#0086b3}pre[data-line]{position:relative;padding:1em 0 1em 3em}pre[data-line] .line-highlight-wrapper{position:absolute;top:0;left:0;background-color:transparent;display:block;width:100%}pre[data-line] .line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}pre[data-line] .line-highlight:before,pre[data-line] .line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}pre[data-line] .line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}html body{font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ol,html body>ul{margin-bottom:16px}html body ol,html body ul{padding-left:2em}html body ol.no-list,html body ul.no-list{padding:0;list-style-type:none}html body ol ol,html body ol ul,html body ul ol,html body ul ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:700;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:700}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::after,html body code::before{letter-spacing:-.2em;content:'\00a0'}html body pre>code{padding:0;margin:0;word-break:normal;white-space:pre;background:0 0;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:after,html body pre code:before,html body pre tt:after,html body pre tt:before{content:normal}html body blockquote,html body dl,html body ol,html body p,html body pre,html body ul{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body code,html body pre{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview ul{list-style:disc}.markdown-preview ul ul{list-style:circle}.markdown-preview ul ul ul{list-style:square}.markdown-preview ol{list-style:decimal}.markdown-preview ol ol,.markdown-preview ul ol{list-style-type:lower-roman}.markdown-preview ol ol ol,.markdown-preview ol ul ol,.markdown-preview ul ol ol,.markdown-preview ul ul ol{list-style-type:lower-alpha}.markdown-preview .newpage,.markdown-preview .pagebreak{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center!important}.markdown-preview:not([data-for=preview]) .code-chunk .code-chunk-btn-group{display:none}.markdown-preview:not([data-for=preview]) .code-chunk .status{display:none}.markdown-preview:not([data-for=preview]) .code-chunk .output-div{margin-bottom:16px}.markdown-preview .md-toc{padding:0}.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link{display:inline;padding:.25rem 0}.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link div,.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link p{display:inline}.markdown-preview .md-toc .md-toc-link-wrapper.highlighted .md-toc-link{font-weight:800}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,.66);border:4px solid rgba(150,150,150,.66);background-clip:content-box}html body[for=html-export]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0;min-height:100vh}@media screen and (min-width:914px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{font-size:14px!important;padding:1em}}@media print{html body[for=html-export]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for=html-export]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,.66);border:4px solid rgba(150,150,150,.66);background-clip:content-box}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc{padding:0 16px}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link{display:inline;padding:.25rem 0}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link div,html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link p{display:inline}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper.highlighted .md-toc-link{font-weight:800}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 300px / 2);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for=html-export]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for=html-export]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */

      </style>
      <!-- The content below will be included at the end of the <head> element. --><script type="text/javascript">
  document.addEventListener("DOMContentLoaded", function () {
    // your code here
  });
</script></head><body for="html-export">
    
    
      <div class="crossnote markdown-preview  ">
      
<h1 id="1-简要说明">1. 简要说明 </h1>
<h2 id="11">1.1 </h2>
<h2 id="12-专有名词">1.2 专有名词 </h2>
<table>
<thead>
<tr>
<th>名称</th>
<th>翻译</th>
<th>介绍</th>
</tr>
</thead>
<tbody>
<tr>
<td>ChirpStack Concentratord</td>
<td>集中器</td>
<td>ChirpStack Concentratord 是一个开源的 LoRa 集中器守护进程。它提供了一个基于 ZeroMQ 的 API，该 API 可以被一个或多个（转发器）应用程序用来与网关硬件进行交互。</td>
</tr>
<tr>
<td>ChirpStack MQTT Forwarder</td>
<td>MQTT转发器</td>
<td>ChirpStack MQTT Forwarder 是一个开源的 Protobuf 或 JSON MQTT 数据包转发器，它可以使用 Semtech UDP 数据包转发器或 ChirpStack Concentratord 作为网关后端。它旨在安装在每个网关上。</td>
</tr>
<tr>
<td>ChirpStack Gateway Bridge</td>
<td>ChirpStack网关桥接器</td>
<td>ChirpStack Gateway Bridge 是一个开源的桥梁，它将从 Semtech UDP 数据包转发器或 Semtech Basic Station 接收到的消息转换为 MQTT。它可以安装在网关上，也可以部署在云端。</td>
</tr>
<tr>
<td>ChirpStack</td>
<td>ChirpStack</td>
<td>ChirpStack 是一个开源的 LoRaWAN 网络服务器，可用于设置私有或公共的 LoRaWAN 网络</td>
</tr>
<tr>
<td>MQTT Broker</td>
<td></td>
<td>MQTT Broker是MQTT协议中的消息代理服务器，负责接收客户端（MQTT Client）发布的消息，并根据客户端的订阅关系，将消息转发给相应的订阅者</td>
</tr>
</tbody>
</table>
<h2 id="13-参考">1.3 参考 </h2>
<p><a href="https://github.com/chirpstack/chirpstack-docs">https://github.com/chirpstack/chirpstack-docs</a></p>
<h1 id="2-技术架构">2. 技术架构 </h1>
<p>以MQTT broker为中心， 可以以不同方式与网关建立连接。主要有一下几种情况：</p>
<p class="dot"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by graphviz version 9.0.0 (20230911.1827)
 -->
<!-- Title: G Pages: 1 -->
<svg width="814pt" height="303pt" viewBox="0.00 0.00 814.00 303.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 299)">
<title>G</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-299 810,-299 810,4 -4,4"></polygon>
<g id="clust6" class="cluster">
<title>cluster_5</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="8,-8 8,-81 222,-81 222,-8 8,-8"></polygon>
<text text-anchor="middle" x="115" y="-68" font-family="Times,serif" font-size="10.00">Integrations</text>
</g>
<g id="clust5" class="cluster">
<title>cluster_4</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="334,-111 334,-287 478,-287 478,-111 334,-111"></polygon>
<text text-anchor="middle" x="406" y="-274" font-family="Times,serif" font-size="10.00">LoRa® Gateway</text>
</g>
<g id="clust1" class="cluster">
<title>cluster_0</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="230,-8 230,-184 326,-184 326,-8 230,-8"></polygon>
<text text-anchor="middle" x="278" y="-171" font-family="Times,serif" font-size="10.00">Cloud / server / VM</text>
</g>
<g id="clust2" class="cluster">
<title>cluster_1</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="486,-111 486,-184 638,-184 638,-111 486,-111"></polygon>
<text text-anchor="middle" x="562" y="-171" font-family="Times,serif" font-size="10.00">LoRa® Gateway</text>
</g>
<g id="clust3" class="cluster">
<title>cluster_2</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="646,-111 646,-184 798,-184 798,-111 646,-111"></polygon>
<text text-anchor="middle" x="722" y="-171" font-family="Times,serif" font-size="10.00">LoRa® Gateway</text>
</g>
<g id="clust4" class="cluster">
<title>cluster_3</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="486,-214 486,-287 612,-287 612,-214 486,-214"></polygon>
<text text-anchor="middle" x="549" y="-274" font-family="Times,serif" font-size="10.00">LoRa® Gateway</text>
</g>
<!-- chirpstack -->
<g id="node1" class="node">
<title>chirpstack</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="237.5,-119.5 237.5,-155.5 298.5,-155.5 298.5,-119.5 237.5,-119.5"></polygon>
<text text-anchor="middle" x="268" y="-134.5" font-family="Times,serif" font-size="10.00">ChirpStack</text>
</g>
<!-- pub&#45;sub -->
<g id="node2" class="node">
<title>pub-sub</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="245.54,-16.5 245.54,-52.5 318.46,-52.5 318.46,-16.5 245.54,-16.5"></polygon>
<text text-anchor="middle" x="282" y="-31.5" font-family="Times,serif" font-size="10.00">MQTT broker</text>
</g>
<!-- chirpstack&#45;&gt;pub&#45;sub -->
<g id="edge1" class="edge">
<title>chirpstack-&gt;pub-sub</title>
<path fill="none" stroke="black" d="M271.93,-108.17C273.84,-94.38 276.13,-77.84 278.05,-64.02"></path>
<polygon fill="black" stroke="black" points="268.49,-107.48 270.58,-117.87 275.42,-108.44 268.49,-107.48"></polygon>
<polygon fill="black" stroke="black" points="281.5,-64.6 279.41,-54.22 274.57,-63.64 281.5,-64.6"></polygon>
<text text-anchor="middle" x="288.17" y="-92" font-family="Times,serif" font-size="10.00">MQTT</text>
</g>
<!-- http&#45;int -->
<g id="node8" class="node">
<title>http-int</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="16,-16.5 16,-52.5 70,-52.5 70,-16.5 16,-16.5"></polygon>
<text text-anchor="middle" x="43" y="-31.5" font-family="Times,serif" font-size="10.00">HTTP</text>
</g>
<!-- chirpstack&#45;&gt;http&#45;int -->
<g id="edge7" class="edge">
<title>chirpstack-&gt;http-int</title>
<path fill="none" stroke="black" d="M237.09,-133.26C197.51,-127.88 128.19,-114.18 79,-81 71.65,-76.04 65.1,-69.12 59.67,-62.16"></path>
<polygon fill="black" stroke="black" points="62.54,-60.16 53.87,-54.07 56.85,-64.24 62.54,-60.16"></polygon>
</g>
<!-- mqtt&#45;int -->
<g id="node9" class="node">
<title>mqtt-int</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="88,-16.5 88,-52.5 142,-52.5 142,-16.5 88,-16.5"></polygon>
<text text-anchor="middle" x="114.67" y="-31.5" font-family="Times,serif" font-size="10.00">MQTT</text>
</g>
<!-- chirpstack&#45;&gt;mqtt&#45;int -->
<g id="edge8" class="edge">
<title>chirpstack-&gt;mqtt-int</title>
<path fill="none" stroke="black" d="M237.25,-126.36C212.31,-117.13 177.12,-101.79 151,-81 144.17,-75.57 137.84,-68.6 132.46,-61.76"></path>
<polygon fill="black" stroke="black" points="135.4,-59.85 126.64,-53.89 129.77,-64.01 135.4,-59.85"></polygon>
</g>
<!-- other&#45;int -->
<g id="node10" class="node">
<title>other-int</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="160,-16.5 160,-52.5 214,-52.5 214,-16.5 160,-16.5"></polygon>
<text text-anchor="middle" x="186.66" y="-31.5" font-family="Times,serif" font-size="10.00">Etc ...</text>
</g>
<!-- chirpstack&#45;&gt;other&#45;int -->
<g id="edge9" class="edge">
<title>chirpstack-&gt;other-int</title>
<path fill="none" stroke="black" d="M254.26,-119.37C241.58,-103.55 222.55,-79.83 207.97,-61.65"></path>
<polygon fill="black" stroke="black" points="210.74,-59.51 201.75,-53.9 205.28,-63.89 210.74,-59.51"></polygon>
</g>
<!-- chirpstack&#45;gateway&#45;bridge&#45;cloud -->
<g id="node3" class="node">
<title>chirpstack-gateway-bridge-cloud</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="341.63,-119.5 341.63,-155.5 470.37,-155.5 470.37,-119.5 341.63,-119.5"></polygon>
<text text-anchor="middle" x="406" y="-134.5" font-family="Times,serif" font-size="10.00">ChirpStack Gateway Bridge</text>
</g>
<!-- chirpstack&#45;gateway&#45;bridge&#45;cloud&#45;&gt;pub&#45;sub -->
<g id="edge2" class="edge">
<title>chirpstack-gateway-bridge-cloud-&gt;pub-sub</title>
<path fill="none" stroke="black" d="M375.91,-111.99C356.57,-96.23 331.53,-75.85 312.18,-60.08"></path>
<polygon fill="black" stroke="black" points="373.55,-114.58 383.51,-118.18 377.97,-109.15 373.55,-114.58"></polygon>
<polygon fill="black" stroke="black" points="314.59,-57.53 304.63,-53.93 310.17,-62.96 314.59,-57.53"></polygon>
<text text-anchor="middle" x="376.17" y="-92" font-family="Times,serif" font-size="10.00">MQTT</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder&#45;gw1 -->
<g id="node4" class="node">
<title>chirpstack-mqtt-forwarder-gw1</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="494.01,-119.5 494.01,-155.5 629.99,-155.5 629.99,-119.5 494.01,-119.5"></polygon>
<text text-anchor="middle" x="562" y="-140.5" font-family="Times,serif" font-size="10.00">UDP Packet Forwarder +</text>
<text text-anchor="middle" x="562" y="-128.5" font-family="Times,serif" font-size="10.00">ChirpStack MQTT Forwarder</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder&#45;gw1&#45;&gt;pub&#45;sub -->
<g id="edge3" class="edge">
<title>chirpstack-mqtt-forwarder-gw1-&gt;pub-sub</title>
<path fill="none" stroke="black" d="M502.78,-115.14C451.13,-96.51 377.19,-69.84 329.39,-52.59"></path>
<polygon fill="black" stroke="black" points="501.53,-118.41 512.12,-118.51 503.9,-111.82 501.53,-118.41"></polygon>
<polygon fill="black" stroke="black" points="330.73,-49.36 320.14,-49.26 328.35,-55.94 330.73,-49.36"></polygon>
<text text-anchor="middle" x="477.17" y="-92" font-family="Times,serif" font-size="10.00">MQTT</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder&#45;gw2 -->
<g id="node5" class="node">
<title>chirpstack-mqtt-forwarder-gw2</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="654.01,-119.5 654.01,-155.5 789.99,-155.5 789.99,-119.5 654.01,-119.5"></polygon>
<text text-anchor="middle" x="722" y="-140.5" font-family="Times,serif" font-size="10.00">ChirpStack Concentratord +</text>
<text text-anchor="middle" x="722" y="-128.5" font-family="Times,serif" font-size="10.00">ChirpStack MQTT Forwarder</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder&#45;gw2&#45;&gt;pub&#45;sub -->
<g id="edge4" class="edge">
<title>chirpstack-mqtt-forwarder-gw2-&gt;pub-sub</title>
<path fill="none" stroke="black" d="M659.56,-115.93C653.65,-114.18 647.73,-112.51 642,-111 531.3,-81.83 399.1,-56.49 329.8,-43.92"></path>
<polygon fill="black" stroke="black" points="658.12,-119.15 668.71,-118.69 660.15,-112.45 658.12,-119.15"></polygon>
<polygon fill="black" stroke="black" points="330.78,-40.54 320.32,-42.21 329.54,-47.43 330.78,-40.54"></polygon>
<text text-anchor="middle" x="607.17" y="-92" font-family="Times,serif" font-size="10.00">MQTT</text>
</g>
<!-- packet&#45;forwarder&#45;gw2 -->
<g id="node6" class="node">
<title>packet-forwarder-gw2</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="494.34,-222.5 494.34,-258.5 603.66,-258.5 603.66,-222.5 494.34,-222.5"></polygon>
<text text-anchor="middle" x="549" y="-237.5" font-family="Times,serif" font-size="10.00">UDP Packet Forwarder</text>
</g>
<!-- packet&#45;forwarder&#45;gw2&#45;&gt;chirpstack&#45;gateway&#45;bridge&#45;cloud -->
<g id="edge5" class="edge">
<title>packet-forwarder-gw2-&gt;chirpstack-gateway-bridge-cloud</title>
<path fill="none" stroke="black" d="M515.32,-215.71C492.63,-199.68 462.79,-178.61 440.02,-162.53"></path>
<polygon fill="black" stroke="black" points="512.99,-218.35 523.18,-221.26 517.03,-212.64 512.99,-218.35"></polygon>
<polygon fill="black" stroke="black" points="442.16,-159.76 431.98,-156.85 438.13,-165.48 442.16,-159.76"></polygon>
<text text-anchor="middle" x="508" y="-195" font-family="Times,serif" font-size="10.00">UDP</text>
</g>
<!-- packet&#45;forwarder&#45;gw3 -->
<g id="node7" class="node">
<title>packet-forwarder-gw3</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="369.53,-222.5 369.53,-258.5 442.47,-258.5 442.47,-222.5 369.53,-222.5"></polygon>
<text text-anchor="middle" x="406" y="-237.5" font-family="Times,serif" font-size="10.00">Basics Station</text>
</g>
<!-- packet&#45;forwarder&#45;gw3&#45;&gt;chirpstack&#45;gateway&#45;bridge&#45;cloud -->
<g id="edge6" class="edge">
<title>packet-forwarder-gw3-&gt;chirpstack-gateway-bridge-cloud</title>
<path fill="none" stroke="black" d="M406,-210.91C406,-197.15 406,-180.7 406,-166.96"></path>
<polygon fill="black" stroke="black" points="402.5,-210.85 406,-220.85 409.5,-210.85 402.5,-210.85"></polygon>
<polygon fill="black" stroke="black" points="409.5,-167.23 406,-157.23 402.5,-167.23 409.5,-167.23"></polygon>
<text text-anchor="middle" x="430.16" y="-195" font-family="Times,serif" font-size="10.00">Websockets</text>
</g>
<!-- as&#45;api&#45;client -->
<g id="node11" class="node">
<title>as-api-client</title>
<polygon fill="none" stroke="black" points="239.59,-222.5 239.59,-258.5 296.41,-258.5 296.41,-222.5 239.59,-222.5"></polygon>
<text text-anchor="middle" x="268" y="-237.5" font-family="Times,serif" font-size="10.00">API client</text>
</g>
<!-- as&#45;api&#45;client&#45;&gt;chirpstack -->
<g id="edge10" class="edge">
<title>as-api-client-&gt;chirpstack</title>
<path fill="none" stroke="black" d="M268,-222.37C268,-207.28 268,-184.99 268,-167.19"></path>
<polygon fill="black" stroke="black" points="271.5,-167.23 268,-157.23 264.5,-167.23 271.5,-167.23"></polygon>
<text text-anchor="middle" x="279.95" y="-195" font-family="Times,serif" font-size="10.00">gRPC</text>
</g>
</g>
</svg>
</p><h1 id="3-chirpstack-concentratordchirpstack集中器">3. ChirpStack Concentratord（ChirpStack集中器） </h1>
<h2 id="31-介绍">3.1 介绍 </h2>
<p>ChirpStack Concentratord 是一个基于 Semtech 硬件抽象层的开源 LoRa(WAN) 集中器守护进程。它提供了一个基于 ZeroMQ 的 API，该 API 可以被一个或多个应用程序用来与网关硬件进行交互。通过将硬件特定实现抽象到一个单独的守护进程中，并通过基于 ZeroMQ 的 API 暴露出来，数据包转发应用程序可以完全与网关硬件解耦。这也使得多个应用程序能够同时与网关硬件进行交互成为可能。例如，多个数据包转发器可以将数据转发到不同的 LoRaWAN 网络服务器。</p>
<h2 id="32-架构例子">3.2 架构例子 </h2>
<p class="dot"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by graphviz version 9.0.0 (20230911.1827)
 -->
<!-- Title: G Pages: 1 -->
<svg width="466pt" height="267pt" viewBox="0.00 0.00 466.00 267.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 263)">
<title>G</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-263 462,-263 462,4 -4,4"></polygon>
<g id="clust1" class="cluster">
<title>cluster_0</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="8,-8 8,-251 450,-251 450,-8 8,-8"></polygon>
<text text-anchor="middle" x="229" y="-238" font-family="Times,serif" font-size="10.00">LoRa® Gateway</text>
</g>
<!-- chirpstack&#45;concentratord -->
<g id="node1" class="node">
<title>chirpstack-concentratord</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="163.65,-101.5 163.65,-137.5 284.35,-137.5 284.35,-101.5 163.65,-101.5"></polygon>
<text text-anchor="middle" x="224" y="-116.5" font-family="Times,serif" font-size="10.00">ChirpStack Concentratord</text>
</g>
<!-- concentrator -->
<g id="node2" class="node">
<title>concentrator</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="166.83,-16.5 166.83,-52.5 281.17,-52.5 281.17,-16.5 166.83,-16.5"></polygon>
<text text-anchor="middle" x="224" y="-31.5" font-family="Times,serif" font-size="10.00">SX1301 / SX1302 / 2G4</text>
</g>
<!-- chirpstack&#45;concentratord&#45;&gt;concentrator -->
<g id="edge1" class="edge">
<title>chirpstack-concentratord-&gt;concentrator</title>
<path fill="none" stroke="black" d="M224,-90.16C224,-81.87 224,-72.79 224,-64.46"></path>
<polygon fill="black" stroke="black" points="220.5,-89.79 224,-99.79 227.5,-89.79 220.5,-89.79"></polygon>
<polygon fill="black" stroke="black" points="227.5,-64.47 224,-54.47 220.5,-64.47 227.5,-64.47"></polygon>
<text text-anchor="middle" x="252.74" y="-74" font-family="Times,serif" font-size="10.00">Semtech HAL</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder -->
<g id="node3" class="node">
<title>chirpstack-mqtt-forwarder</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="306.01,-186.5 306.01,-222.5 441.99,-222.5 441.99,-186.5 306.01,-186.5"></polygon>
<text text-anchor="middle" x="374" y="-201.5" font-family="Times,serif" font-size="10.00">ChirpStack MQTT Forwarder</text>
</g>
<!-- chirpstack&#45;mqtt&#45;forwarder&#45;&gt;chirpstack&#45;concentratord -->
<g id="edge2" class="edge">
<title>chirpstack-mqtt-forwarder-&gt;chirpstack-concentratord</title>
<path fill="none" stroke="black" d="M332.51,-180.54C311.56,-168.95 286.21,-154.92 265.28,-143.34"></path>
<polygon fill="black" stroke="black" points="330.79,-183.59 341.23,-185.37 334.18,-177.46 330.79,-183.59"></polygon>
<polygon fill="black" stroke="black" points="267.17,-140.39 256.73,-138.61 263.78,-146.51 267.17,-140.39"></polygon>
<text text-anchor="middle" x="324.5" y="-159" font-family="Times,serif" font-size="10.00">ZeroMQ</text>
</g>
<!-- chirpstack&#45;udp&#45;forwarder -->
<g id="node4" class="node">
<title>chirpstack-udp-forwarder</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="160.17,-186.5 160.17,-222.5 287.83,-222.5 287.83,-186.5 160.17,-186.5"></polygon>
<text text-anchor="middle" x="224" y="-201.5" font-family="Times,serif" font-size="10.00">ChirpStack UDP Forwarder</text>
</g>
<!-- chirpstack&#45;udp&#45;forwarder&#45;&gt;chirpstack&#45;concentratord -->
<g id="edge3" class="edge">
<title>chirpstack-udp-forwarder-&gt;chirpstack-concentratord</title>
<path fill="none" stroke="black" d="M224,-175.16C224,-166.87 224,-157.79 224,-149.46"></path>
<polygon fill="black" stroke="black" points="220.5,-174.79 224,-184.79 227.5,-174.79 220.5,-174.79"></polygon>
<polygon fill="black" stroke="black" points="227.5,-149.47 224,-139.47 220.5,-149.47 227.5,-149.47"></polygon>
<text text-anchor="middle" x="241.5" y="-159" font-family="Times,serif" font-size="10.00">ZeroMQ</text>
</g>
<!-- monitoring -->
<g id="node5" class="node">
<title>monitoring</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="16.01,-186.5 16.01,-222.5 141.99,-222.5 141.99,-186.5 16.01,-186.5"></polygon>
<text text-anchor="middle" x="79" y="-201.5" font-family="Times,serif" font-size="10.00">Third-party monitoring app</text>
</g>
<!-- monitoring&#45;&gt;chirpstack&#45;concentratord -->
<g id="edge4" class="edge">
<title>monitoring-&gt;chirpstack-concentratord</title>
<path fill="none" stroke="black" d="M119.11,-180.54C139.27,-169 163.64,-155.05 183.82,-143.5"></path>
<polygon fill="black" stroke="black" points="117.65,-177.34 110.71,-185.35 121.13,-183.42 117.65,-177.34"></polygon>
<polygon fill="black" stroke="black" points="185.39,-146.63 192.33,-138.63 181.91,-140.56 185.39,-146.63"></polygon>
<text text-anchor="middle" x="177.5" y="-159" font-family="Times,serif" font-size="10.00">ZeroMQ</text>
</g>
</g>
</svg>
</p><h1 id="4-项目实施">4. 项目实施 </h1>
<h2 id="41-网关需要启动的服务">4.1 网关需要启动的服务 </h2>
<p>一般在烧写镜像完成后，上电就会自动启动。</p>
<pre data-role="codeBlock" data-info="shell" class="language-shell shell"><code><span class="token function">ps</span> aux<span class="token operator">|</span><span class="token function">grep</span> <span class="token parameter variable">-E</span> <span class="token string">'opt|leo|app|scada|redis'</span>
<span class="token comment"># 没有顺序</span>
/etc/init.d/feed_watchdog.sh
/opt/scada/scada
<span class="token comment"># /opt/bridge/apps</span>
/opt/webconfig/webconfig
/home/leo/leo_ns/leo-application-server <span class="token parameter variable">-c</span> /home/leo/leo_ns/leo-application-server.toml
/home/leo/leo_ns/leo-gateway-bridge <span class="token parameter variable">-c</span> /home/leo/leo_ns/leo-gateway-bridge.toml
/home/leo/leo_ns/leo-network-server <span class="token parameter variable">-c</span> /home/leo/leo_ns/leo-network-server.toml
/home/leo/leo_lora/lora_pkt_fwd <span class="token parameter variable">-c</span> /home/leo/leo_lora/global_conf.json
/usr/bin/redis-server <span class="token number">127.0</span>.0.1:6379
/usr/lib/postgresql/14/bin/postgres <span class="token parameter variable">-D</span> /var/lib/postgresql/14/main <span class="token parameter variable">-c</span> <span class="token assign-left variable">config_file</span><span class="token operator">=</span>/etc/postgresql/14/main/postgresql.conf

/usr/sbin/lighttpd <span class="token parameter variable">-D</span> <span class="token parameter variable">-f</span> /etc/lighttpd/lighttpd.conf
</code></pre><h2 id="42--技术方案图">4.2  技术方案图 </h2>
<p class="dot"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by graphviz version 9.0.0 (20230911.1827)
 -->
<!-- Title: G Pages: 1 -->
<svg width="693pt" height="613pt" viewBox="0.00 0.00 693.41 613.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 609)">
<title>G</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-609 689.41,-609 689.41,4 -4,4"></polygon>
<g id="clust3" class="cluster">
<title>cluster_gateway</title>
<polygon fill="cyan" stroke="#bbdefb" points="16,-75 16,-429 314,-429 314,-75 16,-75"></polygon>
<text text-anchor="middle" x="165" y="-416" font-family="Times,serif" font-size="10.00">网关</text>
</g>
<g id="clust5" class="cluster">
<title>cluster_hardware</title>
<polygon fill="#bbdefb" stroke="#bbdefb" points="24,-83 24,-241 306,-241 306,-83 24,-83"></polygon>
<text text-anchor="middle" x="165" y="-228" font-family="Times,serif" font-size="10.00">网关Lora</text>
</g>
<g id="clust1" class="cluster">
<title>cluster_server</title>
<polygon fill="none" stroke="#bbdefb" points="8,-459 8,-597 362,-597 362,-459 8,-459"></polygon>
</g>
<!-- application_server -->
<g id="node1" class="node">
<title>application_server</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="66,-552.5 66,-588.5 120,-588.5 120,-552.5 66,-552.5"></polygon>
<text text-anchor="middle" x="92.67" y="-567.5" font-family="Times,serif" font-size="10.00">APP服务</text>
</g>
<!-- network_server -->
<g id="node2" class="node">
<title>network_server</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="16.25,-467.5 16.25,-503.5 169.75,-503.5 169.75,-467.5 16.25,-467.5"></polygon>
<text text-anchor="middle" x="93" y="-482.5" font-family="Times,serif" font-size="10.00">NS服务(https://121.40.51.33:7777)</text>
</g>
<!-- application_server&#45;&gt;network_server -->
<g id="edge1" class="edge">
<title>application_server-&gt;network_server</title>
<path fill="none" stroke="black" d="M93,-552.3C93,-541.58 93,-527.51 93,-515.14"></path>
<polygon fill="black" stroke="black" points="96.5,-515.47 93,-505.47 89.5,-515.47 96.5,-515.47"></polygon>
</g>
<!-- gateway_bridge -->
<g id="node4" class="node">
<title>gateway_bridge</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="40.68,-279.5 40.68,-315.5 143.32,-315.5 143.32,-279.5 40.68,-279.5"></polygon>
<text text-anchor="middle" x="92" y="-294.5" font-family="Times,serif" font-size="10.00">Lora Gateway Bridge</text>
</g>
<!-- network_server&#45;&gt;gateway_bridge -->
<g id="edge7" class="edge">
<title>network_server-&gt;gateway_bridge</title>
<path fill="none" stroke="black" d="M132.01,-467.1C138.83,-462.25 145.01,-456.26 149,-449 151.57,-444.33 149.78,-442.28 149,-437 144.06,-403.48 139.94,-395.32 127,-364 121.65,-351.04 114.53,-337.28 108.11,-325.73"></path>
<polygon fill="black" stroke="black" points="111.22,-324.11 103.23,-317.15 105.13,-327.57 111.22,-324.11"></polygon>
<text text-anchor="middle" x="185.64" y="-379.5" font-family="Times,serif" font-size="10.00">121.40.51.33:1883</text>
</g>
<!-- lora_pkt_fwd -->
<g id="node6" class="node">
<title>lora_pkt_fwd</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="38.49,-364.5 38.49,-400.5 117.51,-400.5 117.51,-364.5 38.49,-364.5"></polygon>
<text text-anchor="middle" x="78" y="-379.5" font-family="Times,serif" font-size="10.00">Lora Forwarder</text>
</g>
<!-- network_server&#45;&gt;lora_pkt_fwd -->
<g id="edge6" class="edge">
<title>network_server-&gt;lora_pkt_fwd</title>
<path fill="none" stroke="black" d="M46.85,-459.77C43.66,-456.54 40.87,-452.95 38.73,-449 31.47,-435.58 38.67,-420.99 48.8,-408.99"></path>
<polygon fill="black" stroke="black" points="44.41,-462.29 54.29,-466.11 48.95,-456.96 44.41,-462.29"></polygon>
<polygon fill="black" stroke="black" points="51.2,-411.56 55.49,-401.87 46.09,-406.77 51.2,-411.56"></polygon>
<text text-anchor="middle" x="94.13" y="-440" font-family="Times,serif" font-size="10.00">MQTT(121.40.51.33:1883)</text>
</g>
<!-- leo_server -->
<g id="node3" class="node">
<title>leo_server</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="188.02,-467.5 188.02,-503.5 353.98,-503.5 353.98,-467.5 188.02,-467.5"></polygon>
<text text-anchor="middle" x="271" y="-482.5" font-family="Times,serif" font-size="10.00">leo服务(https://app.leotechnology.cn/)</text>
</g>
<!-- scada -->
<g id="node5" class="node">
<title>scada</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="241.89,-279.5 241.89,-315.5 300.11,-315.5 300.11,-279.5 241.89,-279.5"></polygon>
<text text-anchor="middle" x="271" y="-294.5" font-family="Times,serif" font-size="10.00">leo采集程序</text>
</g>
<!-- leo_server&#45;&gt;scada -->
<g id="edge8" class="edge">
<title>leo_server-&gt;scada</title>
<path fill="none" stroke="black" d="M271,-455.65C271,-420.64 271,-361.98 271,-327.09"></path>
<polygon fill="black" stroke="black" points="267.5,-455.49 271,-465.49 274.5,-455.49 267.5,-455.49"></polygon>
<polygon fill="black" stroke="black" points="274.5,-327.33 271,-317.33 267.5,-327.33 274.5,-327.33"></polygon>
</g>
<!-- concentratord -->
<g id="node7" class="node">
<title>concentratord</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="31.65,-176.5 31.65,-212.5 152.35,-212.5 152.35,-176.5 31.65,-176.5"></polygon>
<text text-anchor="middle" x="92" y="-191.5" font-family="Times,serif" font-size="10.00">ChirpStack Concentratord</text>
</g>
<!-- gateway_bridge&#45;&gt;concentratord -->
<g id="edge3" class="edge">
<title>gateway_bridge-&gt;concentratord</title>
<path fill="none" stroke="black" d="M92,-279.37C92,-264.28 92,-241.99 92,-224.19"></path>
<polygon fill="black" stroke="black" points="95.5,-224.23 92,-214.23 88.5,-224.23 95.5,-224.23"></polygon>
<text text-anchor="middle" x="109.5" y="-252" font-family="Times,serif" font-size="10.00">ZeroMQ</text>
</g>
<!-- lora_pkt_fwd&#45;&gt;gateway_bridge -->
<g id="edge2" class="edge">
<title>lora_pkt_fwd-&gt;gateway_bridge</title>
<path fill="none" stroke="black" d="M82.78,-353.16C84.2,-344.77 85.75,-335.58 87.16,-327.17"></path>
<polygon fill="black" stroke="black" points="79.36,-352.37 81.15,-362.81 86.27,-353.53 79.36,-352.37"></polygon>
<polygon fill="black" stroke="black" points="90.59,-327.9 88.8,-317.45 83.69,-326.73 90.59,-327.9"></polygon>
<text text-anchor="middle" x="96" y="-337" font-family="Times,serif" font-size="10.00">UDP</text>
</g>
<!-- HAL -->
<g id="node9" class="node">
<title>HAL</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="34.83,-91.5 34.83,-127.5 149.17,-127.5 149.17,-91.5 34.83,-91.5"></polygon>
<text text-anchor="middle" x="92" y="-106.5" font-family="Times,serif" font-size="10.00">SX1301 / SX1302 / 2G4</text>
</g>
<!-- concentratord&#45;&gt;HAL -->
<g id="edge4" class="edge">
<title>concentratord-&gt;HAL</title>
<path fill="none" stroke="black" d="M92,-176.3C92,-165.58 92,-151.51 92,-139.14"></path>
<polygon fill="black" stroke="black" points="95.5,-139.47 92,-129.47 88.5,-139.47 95.5,-139.47"></polygon>
<text text-anchor="middle" x="120.74" y="-149" font-family="Times,serif" font-size="10.00">Semtech HAL</text>
</g>
<!-- httpd -->
<g id="node8" class="node">
<title>httpd</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="170.44,-176.5 170.44,-212.5 297.56,-212.5 297.56,-176.5 170.44,-176.5"></polygon>
<text text-anchor="middle" x="234" y="-191.5" font-family="Times,serif" font-size="10.00">网关配置服务(https://IP:8080)</text>
</g>
<!-- lora_device -->
<g id="node10" class="node">
<title>lora_device</title>
<polygon fill="#e3f2fd" stroke="#e3f2fd" points="65,-0.5 65,-36.5 119,-36.5 119,-0.5 65,-0.5"></polygon>
<text text-anchor="middle" x="91.94" y="-15.5" font-family="Times,serif" font-size="10.00">Lora设备</text>
</g>
<!-- HAL&#45;&gt;lora_device -->
<g id="edge5" class="edge">
<title>HAL-&gt;lora_device</title>
<path fill="none" stroke="black" d="M92,-80.16C92,-69.95 92,-58.43 92,-48.19"></path>
<polygon fill="black" stroke="black" points="88.5,-79.83 92,-89.83 95.5,-79.83 88.5,-79.83"></polygon>
<polygon fill="black" stroke="black" points="95.5,-48.42 92,-38.42 88.5,-48.42 95.5,-48.42"></polygon>
<text text-anchor="middle" x="108.39" y="-58" font-family="Times,serif" font-size="10.00">Modbus</text>
</g>
<!-- user_step1 -->
<g id="node11" class="node">
<title>user_step1</title>
<polygon fill="none" stroke="black" points="322.01,-279.5 322.01,-315.5 427.99,-315.5 427.99,-279.5 322.01,-279.5"></polygon>
<text text-anchor="middle" x="375" y="-294.5" font-family="Times,serif" font-size="10.00">step1. 用户配置Lora网关</text>
</g>
<!-- user_step1&#45;&gt;httpd -->
<g id="edge9" class="edge">
<title>user_step1-&gt;httpd</title>
<path fill="none" stroke="black" d="M355.45,-279.15C344.67,-269.86 330.9,-258.42 318,-249 303.71,-238.56 287.41,-227.91 273,-218.9"></path>
<polygon fill="black" stroke="black" points="275.01,-216.02 264.66,-213.73 271.32,-221.97 275.01,-216.02"></polygon>
<text text-anchor="middle" x="361.73" y="-252" font-family="Times,serif" font-size="10.00">https://IP:8080</text>
</g>
<!-- user_step2 -->
<g id="node12" class="node">
<title>user_step2</title>
<polygon fill="none" stroke="black" points="370.01,-552.5 370.01,-588.5 475.99,-588.5 475.99,-552.5 370.01,-552.5"></polygon>
<text text-anchor="middle" x="423" y="-567.5" font-family="Times,serif" font-size="10.00">step2. 用户添加Lora网关</text>
</g>
<!-- user_step2&#45;&gt;network_server -->
<g id="edge10" class="edge">
<title>user_step2-&gt;network_server</title>
<path fill="none" stroke="black" d="M369.63,-553C368.41,-552.66 367.2,-552.33 366,-552 304.66,-535.24 234.93,-518.55 181.3,-506.21"></path>
<polygon fill="black" stroke="black" points="182.11,-502.81 171.58,-503.99 180.55,-509.63 182.11,-502.81"></polygon>
<text text-anchor="middle" x="342.53" y="-525" font-family="Times,serif" font-size="10.00">https://121.40.51.33:7777</text>
</g>
<!-- user_step3 -->
<g id="node13" class="node">
<title>user_step3</title>
<polygon fill="none" stroke="black" points="499.45,-552.5 499.45,-588.5 586.55,-588.5 586.55,-552.5 499.45,-552.5"></polygon>
<text text-anchor="middle" x="543" y="-567.5" font-family="Times,serif" font-size="10.00">step3. 用户配置采集</text>
</g>
<!-- user_step3&#45;&gt;leo_server -->
<g id="edge11" class="edge">
<title>user_step3-&gt;leo_server</title>
<path fill="none" stroke="black" d="M539.43,-552.37C536.34,-541.94 530.77,-529.26 521,-522 496.7,-503.95 425.87,-495.04 365.78,-490.67"></path>
<polygon fill="black" stroke="black" points="366.03,-487.17 355.82,-489.98 365.55,-494.16 366.03,-487.17"></polygon>
<text text-anchor="middle" x="608.21" y="-525" font-family="Times,serif" font-size="10.00">[https://](https://app.leotechnology.cn)</text>
</g>
</g>
</svg>
</p><h2 id="43--连接网关">4.3  连接网关 </h2>
<h3 id="431--准备工作">4.3.1  准备工作 </h3>
<p>必须安装packet-forwarder and the ChirpStack Gateway Bridge, 即:</p>
<pre data-role="codeBlock" data-info="shell" class="language-shell shell"><code>/opt/leo_ns/leo-gateway-bridge <span class="token parameter variable">-c</span> /opt/leo_ns/leo-gateway-bridge.toml
/opt/leo_lora/lora_pkt_fwd <span class="token parameter variable">-c</span> /opt/leo_lora/global_conf.json
</code></pre><h3 id="432--配置网关">4.3.2  配置网关 </h3>
<ol>
<li>配置平台地址，服务IP必须指向服务器</li>
</ol>
<p>1） 配置方法一<br>
/opt/leo_lora/global_conf.json</p>
<pre data-role="codeBlock" data-info="toml" class="language-toml toml"><code><span class="token comment"># Generic MQTT authentication.</span>
<span class="token punctuation">[</span><span class="token table class-name">integration.mqtt.auth.generic</span><span class="token punctuation">]</span>
<span class="token comment"># MQTT servers.</span>
<span class="token comment">#</span>
<span class="token comment"># Configure one or multiple MQTT server to connect to. Each item must be in</span>
<span class="token comment"># the following format: scheme://host:port where scheme is tcp, ssl or ws.</span>
<span class="token key property">servers</span><span class="token punctuation">=</span><span class="token punctuation">[</span>
  <span class="token string">"tcp://121.40.51.33:1883"</span><span class="token punctuation">,</span>
<span class="token punctuation">]</span>
</code></pre><p>2） 配置方法二<br>
通过网页配置： <a href="https://xn--IP-j04co35o:8080">https://网关IP:8080</a><br>
<img src="figures/image.png" alt="https://网关IP:8080"></p>
<p>上下行端口默认为1700。</p>
<p>记住网关UUID，第二步使用。</p>
<ol start="2">
<li>添加网关UUID<br>
<a href="http://121.40.51.33:7777/#/organizations/1/gateways">http://121.40.51.33:7777/#/organizations/1/gateways</a></li>
</ol>
<p>在页面添加网关，将网关UUID填入。</p>
<h3 id="433-验证">4.3.3 验证 </h3>
<p>1） 验证方法一：</p>
<pre data-role="codeBlock" data-info="bash" class="language-bash bash"><code>mosquitto_sub <span class="token parameter variable">-v</span> <span class="token parameter variable">-t</span> <span class="token string">"+/gateway/#"</span>
</code></pre><p>2） 验证方法二：<br>
打开<br>
<a href="http://121.40.51.33:7777/#/organizations/1/gateways">http://121.40.51.33:7777/#/organizations/1/gateways</a><br>
查看，Last seen， 如果是Never表示还未连接上，如果是 a few seconds ago表示已经连接上了。<br>
<img src="figures/image-1.png" alt="Alt text"></p>
<h2 id="44-连接lora设备">4.4 连接Lora设备 </h2>
<h3 id="441--准备工作">4.4.1  准备工作 </h3>
<p>需要知道Lora设备以下信息，一般在设备标签上有：</p>
<ul>
<li>DevEUI</li>
<li>LoRaWAN MAC版本</li>
<li>区域参数修订版本</li>
</ul>
<p>两种激活方式，二选一:</p>
<table>
<thead>
<tr>
<th>激活方式</th>
<th>描述</th>
<th>所需参数</th>
</tr>
</thead>
<tbody>
<tr>
<td>OTAA</td>
<td>模块通过加入网络（JOIN）操作，来获得网络安全密钥</td>
<td>DevEUI、AppEUI、AppKey，同时设置为OTAA激活方式。</td>
</tr>
<tr>
<td>ABP</td>
<td>模块本地已经保存网络会话密钥、应用加密密钥等，可以加入指定的 LoRaWAN 服务器</td>
<td>DevAddr 、 NwkSkey 、 AppSkey，同时设置为 ABP激活</td>
</tr>
</tbody>
</table>
<p>表格中参数不需要用户填写，由服务器分配，并由网关发命令设置到Lora设备。</p>
<h3 id="441--配置设备">4.4.1  配置设备 </h3>
<p><strong>下面按一下步骤获取相关参数：</strong></p>
<p>通过串口发送命令获取：<br>
串口配置: 19200 N 8 1</p>
<p>查询是否是OTAA方式:</p>
<pre data-role="codeBlock" data-info="bash" class="language-bash bash"><code><span class="token punctuation">[</span><span class="token number">15</span>:35:23.943<span class="token punctuation">]</span>发→◇AT+OTAA?
□
<span class="token punctuation">[</span><span class="token number">15</span>:35:23.965<span class="token punctuation">]</span>收←◆+OTAA:1
</code></pre><p>返回1表明是OTAA方式， 0表示ABP方式。</p>
<p><strong>OTAA方式激活</strong>（必须执行，否则无法入网）:</p>
<pre data-role="codeBlock" data-info="shell" class="language-shell shell"><code>AT+OTAA<span class="token operator">=</span><span class="token number">1</span>  <span class="token comment"># 激活方式</span>
AT+JOIN<span class="token operator">=</span>OTAA,a514160b00000432,0000000000000007,01020304050607080102030405060708  <span class="token comment">#激活命令，会触发JOIN 入网操作</span>
</code></pre><p>激活之后，进入applications-&gt;Devices-&gt;选择你添加的设备-&gt;激活：<br>
<img src="figures/image-2.png" alt="Alt text"></p>
<p>查询并设置参数，主要关注DEVEUI,APPKEY：</p>
<pre data-role="codeBlock" data-info="bash" class="language-bash bash"><code><span class="token comment"># 一般参数</span>
<span class="token punctuation">[</span><span class="token number">16</span>:10:41.256<span class="token punctuation">]</span>发→◇AT+CLASS?
<span class="token punctuation">[</span><span class="token number">16</span>:10:41.280<span class="token punctuation">]</span>收←◆+CLASS:0 <span class="token comment"># 表示CLASS A</span>

<span class="token punctuation">[</span><span class="token number">16</span>:11:31.641<span class="token punctuation">]</span>发→◇AT+ADR?
<span class="token punctuation">[</span><span class="token number">16</span>:11:31.663<span class="token punctuation">]</span>收←◆+ADR:0 <span class="token comment"># ADR不使能，需要使能</span>

<span class="token punctuation">[</span><span class="token number">16</span>:15:45.310<span class="token punctuation">]</span>发→◇AT+ADR<span class="token operator">=</span><span class="token number">1</span>
<span class="token punctuation">[</span><span class="token number">16</span>:15:45.519<span class="token punctuation">]</span>收←◆OK

<span class="token comment">#  OTAA 所需的参数</span>
<span class="token punctuation">[</span><span class="token number">15</span>:16:44.732<span class="token punctuation">]</span>发→◇AT+DEVEUI?
<span class="token punctuation">[</span><span class="token number">15</span>:16:44.766<span class="token punctuation">]</span>收←◆+DEVEUI:a514160b00000432

<span class="token punctuation">[</span><span class="token number">15</span>:25:45.748<span class="token punctuation">]</span>发→◇AT+APPEUI?
<span class="token punctuation">[</span><span class="token number">15</span>:25:45.782<span class="token punctuation">]</span>收←◆+APPEUI:0000000000000000

<span class="token punctuation">[</span><span class="token number">15</span>:26:03.033<span class="token punctuation">]</span>发→◇AT+APPKEY?
<span class="token punctuation">[</span><span class="token number">15</span>:26:03.069<span class="token punctuation">]</span>收←◆+APPKEY:01020304050607080102030405060708

<span class="token comment"># 下面是ABP方式所需的参数</span>
<span class="token punctuation">[</span><span class="token number">15</span>:28:51.587<span class="token punctuation">]</span>发→◇AT+DEVADDR?
<span class="token punctuation">[</span><span class="token number">15</span>:28:51.617<span class="token punctuation">]</span>收←◆+DEVADDR:00000000

<span class="token punctuation">[</span><span class="token number">15</span>:29:34.019<span class="token punctuation">]</span>发→◇AT+NWKSKEY?
<span class="token punctuation">[</span><span class="token number">15</span>:29:34.055<span class="token punctuation">]</span>收←◆+NWKSKEY:00000000000000000000000000000000

<span class="token punctuation">[</span><span class="token number">15</span>:29:45.500<span class="token punctuation">]</span>发→◇AT+APPSKEY?
<span class="token punctuation">[</span><span class="token number">15</span>:29:45.536<span class="token punctuation">]</span>收←◆+APPSKEY:00000000000000000000000000000000
</code></pre>
      </div>
      
      
    
    
    
    
    
    
  
    </body></html>